home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Installer SDK Cornucopia 1.0.2 / Script Examples / • Example Example / Example.r < prev    next >
Encoding:
Text File  |  1996-10-08  |  14.8 KB  |  369 lines  |  [TEXT/MPS ]

  1. //
  2. //    example.r    
  3. //
  4. //
  5. //        This example is intended as a guideline for working with the
  6. //        rest of the examples included with the Installer SDK. This
  7. //        example, using the InstaCompOne compression/decompression,
  8. //        installs one copy of a SimpleText file called "Example File"
  9. //        to a folder named "Example Example" on the selected target volume.
  10. //
  11. //        To use any one of the examples, launch MPW ( Macintosh Programmer's
  12. //        Workshop ), and set the current working directory to the folder
  13. //        containing the example you are working on.
  14. //
  15. //        Most MPW configurations include a "Directory" menu. You may choose
  16. //        the current working directory by choosing "Set Directory…" from
  17. //        the "Directory" menu.
  18. //
  19. //        Each installation example includes a source script for the install
  20. //        script to be included with the installation disks. This source script
  21. //        is an MPW text file, and is always named with a ".r" extension. For
  22. //        this example the source script is named "Example.r".
  23. //
  24. //        Also included in each example is a build script in makefile form. 
  25. //        This makefile is an MPW text file, and is named "makefile" in all
  26. //        the examples. This makefile is called when you tell MPW to build
  27. //        the installation script to be included with the installation disks.
  28. //
  29. //        Each example also includes the compiled ( actually rezzed ) script
  30. //        that will be placed on the installation disks. This "finished"
  31. //        installer script will serve to "drive" the Installer application
  32. //        on your installation disks. In this case the finished installer 
  33. //        script is named "Example".
  34. //
  35. //        A debugger version of the finished installer script is also included
  36. //        and is named by appending "w/ debugger" to the original finished
  37. //        installer script. In this case it is called "Example w/ debugger".
  38. //
  39. //
  40. //    How To Build the Script:
  41. //    
  42. //        To build installer script to include on installation disks, select
  43. //        the "Build…" menu item from the "Build" menu. Enter the scriptName
  44. //        without the .r extension, which in the case of this example would 
  45. //        be "Example". ( Do not include the double quotes )
  46. //
  47. //        To build the Installer Debugger version of the installer script enter 
  48. //        the scriptname with the addition ".debug", which in this case would
  49. //        be "Example.debug". ( Do not include the double quotes )
  50. //
  51. //    If you are using InstaCompOne compression or splitting:
  52. //
  53. //        You must also include a copy of the file "InstaCompOneSCExt.rsrc"
  54. //        that has been renamed to "fileCompress.scx". This file can be found
  55. //        inside the folder "Tools:Released:InstaCompOne 1.1:" included in the SDK.
  56. //        The renamed file is a ScriptCheck extension that will add functionality
  57. //        to ScriptCheck for dealing with InstaCompOne archives. For your
  58. //        convenience, a copy of this renamed file will be placed in this folder
  59. //        when the makefile is run by the "Build" command.
  60. //
  61. //    Running the installation examples:
  62. //
  63. //        From your hard drive -
  64. //
  65. //        The most convenient way to run the examples is to place a copy of
  66. //        the Installer 4.0.3 application on your desktop. Then from within 
  67. //        the Finder, open the folder containing the example to try out, and
  68. //        drag-drop the finished installer script onto the Installer 4.0.3 
  69. //        application on your desktop. This will allow you to run the examples 
  70. //        directly from the Installer SDK folders, rather than having to copy 
  71. //        files onto a diskette.
  72. //
  73. //        From a diskette -
  74. //
  75. //        Insert a diskette, and rename it to "Disk 1". Be sure this name
  76. //        is entered correctly with a space. Take all the contents of 
  77. //        "Disk 1", which in this case is the "Tome" file.  Also, you will 
  78. //        need to copy over the finished or rezzed installer script and a copy 
  79. //        of the Installer application. If you are going to run the debugger 
  80. //        version of the installer script be sure to copy over the debugger 
  81. //        version of the Installer application.
  82. //
  83. //        NOTE: Some of the examples use copies of files (SimpleText or Example File) that  
  84. //        have been slightly modified, so be careful to use the actual copy of 
  85. //        the file from the specific example when preparing an installation diskette.
  86. //
  87. //    Running the debugger version of the examples:
  88. //
  89. //        Place a copy of the Debugger version of the Installer 4.0.3 application 
  90. //        on your desktop. Then drag-drop a debugger version of the finished 
  91. //        installer script onto the debugger version of the installer on the 
  92. //        desktop. The installer debugger will display information about the 
  93. //        progress of the installation in a window. 
  94. //
  95. //        To get even more out of the installer debugger, click in 
  96. //        the debugger window before actually beginning an installation. You
  97. //        may then select from the two menus "Wasabi" and "Show" to select
  98. //        different options for displayed information. Especially helpful are
  99. //        the "Show" menu items "Frameworks", "Rules", and "Rules Clauses".
  100. //        If the "Frameworks", "Rules", "Rules Clauses" are checked in the
  101. //        debugger menu, then the analysis of rules is displayed each time
  102. //        one of the rules frameworks is run. You can force this to happen
  103. //        by selecting back and forth between Easy Install and Custom Install,
  104. //        by clicking in the "Switch Disk" button, or by going to the Finder
  105. //        and returning the the Installer application.
  106. //
  107. //        NOTE: This example does not use installer frameworks or rule clauses
  108. //        so it's probably not the best place to check out the debugger support
  109. //        for checking out rules and frameworks from the debugger. For a good
  110. //        example of rules and frameworks, try the "System Rules - Desk Accessory"
  111. //        and "System Rules - Application" examples included with the SDK.
  112. //
  113. //    Copyright 1994-1996, Apple Computer, Inc., All Rights Reserved
  114. //
  115.  
  116. #include "InstallerTypes.r"
  117.  
  118. // Include the InstaCompOne atom extender stuff
  119. // making sure not to add their version resource
  120. // to our installer script. Also, since this include
  121. // is a resource include instead of a #include, it is
  122. // not actually a pre-processor thing, and won't be effected
  123. // by a -i option within the rez line in the makefile. 
  124. include ":::Tools:Released:InstaCompOne 1.1:InstaCompAtomExt.rsrc" NOT 'vers';
  125.  
  126.  
  127. // • packages
  128.  
  129. // package that demonstrates simple case of InstaCompOne archive
  130. resource 'inpk' (100) {
  131.     format0 {
  132.         showsOnCustom,        // This flag determines whether or not
  133.                             // the package will be visible as a 
  134.                             // sub-package in Custom Install, otherwise 
  135.                             // this flag is ignored when using 4.0
  136.                             // method of creating Custom Install
  137.                             // user selectable options.
  138.                             
  139.         removable,            // This flag determines whether or not
  140.                             // not the package should be listed in
  141.                             // Custom Install as removable, and whether
  142.                             // to remove this package when performing
  143.                             // a Custom Removal.
  144.                             
  145.         dontForceRestart,    // If any packages that are included in an
  146.                             // installation have this flag set to
  147.                             // 'forceRestart', then the user will be
  148.                             // forced to restart their computer 
  149.                             // immediately after installation.
  150.  
  151.         0,                    // Package comment ('inpc' or 'icmt' ) rsrc ID.
  152.                             // NOTE: usage of the new package comment
  153.                             // resource ( 'inpc' ), allows inclusion
  154.                             // of up to 32K of text to describe a package.
  155.                             // This extends the limit of 255 characters
  156.                             // of description text in the old style
  157.                             // 'icmt' package comments resource type.
  158.                             
  159.                             // For full demonstration of implementing
  160.                             // package comment resources, see the
  161.                             // 'Custom UI Example' included with
  162.                             // the Installer SDK examples.
  163.                             
  164.         0,                    // Total size of all files included in
  165.                             // this package. If value is zero, this
  166.                             // field will be filled by ScriptCheck.
  167.                             // NOTE: This field is not used during
  168.                             // checks for sufficient disk space, but
  169.                             // is displayed to user during Custom Install.
  170.                             
  171.         "Example File to \"Example Example\" folder ( InstaCompOne compression )",
  172.                             // The description of the package when
  173.                             // displayed as a selectable option 
  174.                             // in Custom Install and Custom Remove
  175.         {    
  176.         'infa', 1000;        // List of all the items to be included
  177.                             // as part of this package. This list can
  178.                             // contain any of the atom resource types,
  179.                             // other package resources, or in the case
  180.                             // of a package being used as a divider line
  181.                             // this list can be empty.
  182.         },
  183.     }
  184. };
  185.  
  186. // • file atoms
  187.  
  188. resource 'infa' (1000) {
  189.     format1 {
  190.         deleteWhenRemoving,                //  Delete on deinstall
  191.         deleteWhenInstalling,            //  Remove preexisting
  192.         copy,                            //  Copy on Install
  193.         dontIgnoreLockedFile,            //  Respect file locking
  194.         dontSetFileLocked,                //  Leave installed file unlocked
  195.         useSrcCrDateToCompare,            //  Use creation date for compare
  196.         srcNeedNotExist,                //  Create a new file if necessary
  197.         
  198.         // this line must be set to "rsrcForkInDataFork" when working 
  199.         // with file items compressed into InstaCompOne archives,
  200.         // otherwise this flag should be set to 'rsrcForkInRsrcFork'
  201.         rsrcForkInDataFork,                //  • Resource stuff in Data fork
  202.         
  203.         leaveAloneIfNewer,                //  On Easy Install, this causes
  204.                                         //    the target file to be preserved
  205.                                         //     if it is newer than the one
  206.                                         //    about to replace it. On Custom
  207.                                         //     Install this causes a dialog to
  208.                                         //     be displayed to the user asking
  209.                                         //  "Newer, Older, Cancel"
  210.                                         
  211.         updateExisting,                    //  Update an existing file
  212.         copyIfNewOrUpdate,                //  Copy whether target exists or not
  213.         rsrcFork,                        //  Copy resource fork
  214.         dataFork,                        //  Copy data fork
  215.         
  216.         0,                    // TARGET - size ( filled in by ScriptCheck )
  217.         0x0,                // finder attribute flags ( filled in by ScriptCheck )
  218.         10000,                // TARGET - file spec ( 'intf' )
  219.         {    
  220.             10000,            // SOURCE - file spec ( 'infs' )
  221.             0,                 // DATA fork - size ( filled in by ScriptCheck )
  222.             0                // RSRC fork - size ( filled in by ScriptCheck )
  223.         },    
  224.         
  225.         0x0,                // SOURCE - version number for comparisons
  226.                             // value of 0x0 specifies not to perform 
  227.                             // version comparison
  228.                             
  229.         0,                    // 'invc' code resource - version comparison routine 
  230.                             //    ( none used here )
  231.         
  232.         241,                // 'inex' resource definition for atom extender
  233.                             // • #241 is for built in InstaCompOne extender
  234.                             
  235.         ""                    // file atom description 
  236.                             // ( Installer will use filename if blank )
  237.     }
  238. };
  239.  
  240.  
  241. // • file specs
  242.  
  243. // NOTE: Installer 4.0.3 supports both 'intf' and 'infs' resource types
  244. // as target file specs. It is recommended that 'intf' format1 be used.
  245.  
  246. // target file spec
  247. resource 'intf' (10000) {
  248.     format1 {
  249.         noSearchForFile,        // use default search path
  250.         
  251.                                 // NOTE: See the "Search Proc [insp]
  252.                                 // Example" for an example of how to
  253.                                 // override default search path
  254.         
  255.         // If the TypeCrNeedNotMatch flag is specified,
  256.         // then the two fields of Type and Creator will be ignored
  257.         // unless InstaCompOne compression is being used.
  258.         
  259.         // If the TypeCrMustMatch flag is specified, then
  260.         // the installer will give an error message that the
  261.         // target file cannot be replaced when the target
  262.         // file's Type and Creator do not match those specified here.
  263.         
  264.         TypeCrNeedNotMatch,        // target type and creator don't have to match
  265.         
  266.         'ttro',                    // TYPE ( for file search if 'searchForFile' )
  267.         'ttxt',                    // CREATOR ( for file search if 'searchForFile' )
  268.         
  269.                                 // NOTE: If using InstaCompOne compression
  270.                                 // these values are also used to 
  271.                                 // specify which compressed file within
  272.                                 // an archive should be expanded during
  273.                                 // installation of a file atom. ( see below )
  274.  
  275.         
  276.         // The next three fields are provided so that the scriptwriter
  277.         // can specify certain file information when creating a new file
  278.         // or updating an existing one. If ScriptCheck fills in the values
  279.         // it will use the values from the existing source file.
  280.         
  281.         0x0,                    // Target - finder flags
  282.                                 //    ( ScriptCheck fills in flags if set to 0 )
  283.         
  284.         1,                        // Target - creation date 
  285.         1,                        // Target - mod date 
  286.                                 //    ( ScriptCheck fills in dates set to 1 )
  287.                                 
  288.         0,                        // 'insp' resource ID ( file search proc )
  289.                                 // none used in this case
  290.                                 
  291.                                 // NOTE: the file search proc feature is
  292.                                 // only supported with file atoms ( 'infa' )
  293.                                 // and resource atoms ( 'inra' ). All other
  294.                                 // atoms referencing an 'intf' with an 'insp'
  295.                                 // reference will use the default file search
  296.                                 // mechanism of the installer.
  297.                                 
  298.         ":Example Example:Example File"    // path to target file
  299.         
  300.                         // NOTE: when using InstaCompOne compression
  301.                         // the filename specified in the path to 
  302.                         // target file ( along with the type and 
  303.                         // creator specified above ) are used to 
  304.                         // specify which file within the source archive 
  305.                         // should be be decompressed. This filename,
  306.                         // type, and creator must match exactly those
  307.                         // of the compressed file item within the archive.
  308.                         // If ScriptCheck tells you there is a problem 
  309.                         // #28202, then check the filename in the target 
  310.                         // path, type, creator to be sure that they matche
  311.                         // filename, type, creator in the archive. You can 
  312.                         // check the filename, type, creator in the archive 
  313.                         // by using the command
  314.                         // [ InstaCompOneTool -o archiveName -L ] in MPW.
  315.                                 
  316.     }
  317. };
  318.  
  319.  
  320. // source file spec
  321. resource 'infs' (10000) {
  322.     'idcp',                        // TYPE of source file
  323.     'kakc',                        // CREATOR of source file
  324.                                 
  325.                                 // NOTE: When using InstaCompOne compression
  326.                                 // for files ( as in this example ) these values
  327.                                 // should always be used ( 'idcp' and 'kakc' ).
  328.                                 
  329.                                 // When using InstaCompOne compression for
  330.                                 // resource items, the type should be 'ircp'
  331.                                 // and the creator should be 'kakc'.
  332.                                 
  333.                                 // When not using InstaCompOne compression
  334.                                 // these values should match those of your
  335.                                 // source file.
  336.                                 
  337.     0x1,                        // creation DATE for source file
  338.                                 // value of zero matches any date
  339.                                 // value of 1 filled by ScriptCheck
  340.                                 
  341.     noSearchForFile,            // IGNORED in Installer 4.0.x
  342.     
  343.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  344.                                 
  345.                                 // NOTE: If 'TypeCrMustMatch' is used, 
  346.                                 // ScriptCheck will complain if type and
  347.                                 // creator of source file do not match,
  348.                                 // and an error will occur during installation.
  349.                                 
  350.                                 // If 'TypeCrNeedNotMatch' is used,
  351.                                 // type and creator of source file will be
  352.                                 // ignored.
  353.                                 
  354.                                 // When using InstaCompOne compression, this
  355.                                 // fields should always be 'TypeCrMustMatch'
  356.                                 
  357.     "Disk 1:Tome"                // PATH to source file        
  358.     
  359.                                 // NOTE: When using InstaCompOne compression
  360.                                 // this should be path to the archive containing
  361.                                 // the file to be decompressed. The actual name
  362.                                 // of the file to be decompressed is specified
  363.                                 // in the target file spec ( 'intf' ).
  364.                                 
  365.                                 // When not using InstaCompOne compression
  366.                                 // this should be path to the file to install.
  367. };
  368.  
  369.